home *** CD-ROM | disk | FTP | other *** search
- #ifndef FWSTRMF_H
- #define FWSTRMF_H
- //========================================================================================
- //
- // File: FWStrmF.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWASINKS_H
- #include "FWASinks.h"
- #endif
-
- #ifndef FWPRIEXC_H
- #include "FWPriExc.h"
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // Exception constants
- //========================================================================================
-
- const FW_PlatformError FW_xReadableStreamFormatter = -30000; // !!! JEL !!! Need approved values
- const FW_PlatformError FW_xWritableStreamFormatter = -30001; // !!! JEL !!! Need approved values
-
- //========================================================================================
- // CLASS FW_CReadableStreamFormatter
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CReadableStreamFormatter FW_AUTO_DESTRUCT_OBJECT
- {
-
- public:
-
- FW_CReadableStreamFormatter();
- virtual~ FW_CReadableStreamFormatter();
-
- virtual void ReadBytes(FW_CSink& sink,
- void* destination,
- long count);
-
- virtual void ReadChars(FW_CSink& sink,
- char* destination,
- long count);
-
- virtual void ReadSignedChars(FW_CSink& sink,
- signed char* destination,
- long count);
-
- virtual void ReadUnsignedChars(FW_CSink& sink,
- unsigned char* destination,
- long count);
-
- virtual void ReadNullTerminatedString(FW_CSink& sink,
- char* destination);
-
- virtual void ReadInts(FW_CSink& sink,
- int* destination,
- long count);
-
- virtual void ReadUnsignedInts(FW_CSink& sink,
- unsigned int* destination,
- long count);
-
- virtual void ReadShorts(FW_CSink& sink,
- short* destination,
- long count);
-
- virtual void ReadUnsignedShorts(FW_CSink& sink,
- unsigned short* destination,
- long count);
-
- virtual void ReadLongs(FW_CSink& sink,
- long* destination,
- long count);
-
- virtual void ReadUnsignedLongs(FW_CSink& sink,
- unsigned long* destination,
- long count);
-
- virtual void ReadFloats(FW_CSink& sink,
- float* destination,
- long count);
-
- virtual void ReadDoubles(FW_CSink& sink,
- double* destination,
- long count);
-
- #ifdef FW_COMPILER_SUPPORTS_LONG_DOUBLE
- virtual void ReadLongDoubles(FW_CSink& sink,
- long double* destination,
- long count);
- #endif
-
- protected:
-
- void Identity(FW_CSink& sink,
- void* destination,
- long count,
- long itemSize);
-
- private:
- FW_CReadableStreamFormatter(const FW_CReadableStreamFormatter& formatter);
- FW_CReadableStreamFormatter& operator=(const FW_CReadableStreamFormatter& formatter);
- // Shouldn't copy instances of this class.
- };
-
-
- //========================================================================================
- // CLASS FW_CWritableStreamFormatter
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CWritableStreamFormatter FW_AUTO_DESTRUCT_OBJECT
- {
-
- public:
-
- FW_CWritableStreamFormatter();
- virtual~ FW_CWritableStreamFormatter();
-
- virtual void WriteBytes(FW_CSink& sink,
- const void* source,
- long count);
-
- virtual void WriteChars(FW_CSink& sink,
- const char* source,
- long count);
-
- virtual void WriteSignedChars(FW_CSink& sink,
- const signed char* source,
- long count);
-
- virtual void WriteUnsignedChars(FW_CSink& sink,
- const unsigned char* source,
- long count);
-
- virtual void WriteNullTerminatedString(FW_CSink& sink,
- const char* source);
-
- virtual void WriteInts(FW_CSink& sink,
- const int* source,
- long count);
-
- virtual void WriteUnsignedInts(FW_CSink& sink,
- const unsigned int* source,
- long count);
-
- virtual void WriteShorts(FW_CSink& sink,
- const short* source,
- long count);
-
- virtual void WriteUnsignedShorts(FW_CSink& sink,
- const unsigned short* source,
- long count);
-
- virtual void WriteLongs(FW_CSink& sink,
- const long* source,
- long count);
-
- virtual void WriteUnsignedLongs(FW_CSink& sink,
- const unsigned long* source,
- long count);
-
- virtual void WriteFloats(FW_CSink& sink,
- const float* source,
- long count);
-
- virtual void WriteDoubles(FW_CSink& sink,
- const double* source,
- long count);
-
- #ifdef FW_COMPILER_SUPPORTS_LONG_DOUBLE
- virtual void WriteLongDoubles(FW_CSink& sink,
- const long double* source,
- long count);
- #endif
-
- protected:
-
- void Identity(FW_CSink& sink,
- const void* source,
- long count,
- long itemSize);
-
- private:
- FW_CWritableStreamFormatter(const FW_CWritableStreamFormatter& formatter);
- FW_CWritableStreamFormatter& operator=(const FW_CWritableStreamFormatter& formatter);
- // Shouldn't copy instances of this class.
- };
-
-
- //======================================================================================
- // class FW_CByteSwapper
- //======================================================================================
-
- class FW_CLASS_ATTR FW_CByteSwapper
- {
- public:
- static void SwapShort(void *aShort);
- static void SwapLong(void *aLong);
- };
-
-
- //======================================================================================
- // class FW_CReadableSwapBytesFormatter
- //======================================================================================
-
- class FW_CLASS_ATTR FW_CReadableSwapBytesFormatter : public FW_CReadableStreamFormatter
- {
- public:
-
- FW_CReadableSwapBytesFormatter();
- virtual~ FW_CReadableSwapBytesFormatter();
-
- virtual void ReadInts(FW_CSink& sink,
- int* destination,
- long count);
-
- virtual void ReadUnsignedInts(FW_CSink& sink,
- unsigned int* destination,
- long count);
-
- virtual void ReadShorts(FW_CSink& sink,
- short* destination,
- long count);
-
- virtual void ReadUnsignedShorts(FW_CSink& sink,
- unsigned short* destination,
- long count);
-
- virtual void ReadLongs(FW_CSink& sink,
- long* destination,
- long count);
-
- virtual void ReadUnsignedLongs(FW_CSink& sink,
- unsigned long* destination,
- long count);
- };
-
-
- //======================================================================================
- // class FW_CWritableSwapBytesFormatter
- //======================================================================================
-
- class FW_CLASS_ATTR FW_CWritableSwapBytesFormatter : public FW_CWritableStreamFormatter
- {
- public:
-
- FW_CWritableSwapBytesFormatter();
- virtual~ FW_CWritableSwapBytesFormatter();
-
- virtual void WriteInts(FW_CSink& sink,
- const int* source,
- long count);
-
- virtual void WriteUnsignedInts(FW_CSink& sink,
- const unsigned int* source,
- long count);
-
- virtual void WriteShorts(FW_CSink& sink,
- const short* source,
- long count);
-
- virtual void WriteUnsignedShorts(FW_CSink& sink,
- const unsigned short* source,
- long count);
-
- virtual void WriteLongs(FW_CSink& sink,
- const long* source,
- long count);
-
- virtual void WriteUnsignedLongs(FW_CSink& sink,
- const unsigned long* source,
- long count);
- };
-
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-